package com.fourforfo.fourmall.order.vo;

import lombok.ToString;

import java.math.BigDecimal;
import java.util.List;

/**
 * @program: fourmall
 * @description: 购物项信息
 * @author: fourforfo
 * @email: fourforfo@gmail.com
 * @create: 2022-08-23 14:27
 **/
@ToString
public class CartItemVO {

    private Long skuId;

    //是否被选中
    private Boolean check = true;

    private String title;

    private String imageUrl;

    private BigDecimal price = new BigDecimal(0);

    private Integer count = 0;

    private BigDecimal totalPrice = new BigDecimal(0);

    /**
     * 保存的是使用分隔符拼装的attrId和attr信息 id:attrName
     */
    private List<String> skuAttr;

    private boolean hasStock;

    public Boolean getHasStock() {
        return hasStock;
    }

    public void setHasStock(Boolean hasStock) {
        this.hasStock = hasStock;
    }

    public Long getSkuId() {
        return skuId;
    }

    public void setSkuId(Long skuId) {
        this.skuId = skuId;
    }

    public Boolean getCheck() {
        return check;
    }

    public void setCheck(Boolean check) {
        this.check = check;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getImageUrl() {
        return imageUrl;
    }

    public void setImageUrl(String imageUrl) {
        this.imageUrl = imageUrl;
    }

    public BigDecimal getPrice() {
        return price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    public Integer getCount() {
        return count;
    }

    public void setCount(Integer count) {
        this.count = count;
    }

    public BigDecimal getTotalPrice() {
        //后端使用的totalPrice，使用时就不用再次计算了
        return this.price.multiply(new BigDecimal(""+this.count));

    }

    public List<String> getSkuAttr() {
        return skuAttr;
    }

    public void setSkuAttr(List<String> skuAttr) {
        this.skuAttr = skuAttr;
    }
}
